home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / gnu / emacs_src_18_58.lha / emacs-18.58 / src / dostrip.c < prev    next >
C/C++ Source or Header  |  1992-04-26  |  390b  |  24 lines

  1. #include <stdio.h>
  2.  
  3. #define SIZE 2048
  4.  
  5. main(int argc, char **argv)
  6. {
  7.     char buf[SIZE];
  8.  
  9.     buf[SIZE - 1] = 0;
  10.     while (fgets(buf, SIZE - 1, stdin))
  11.     {
  12.     if (buf[0] != '#')
  13.     {
  14.         char *p = buf, *e;
  15.  
  16.         while (*p && *p == ' ') p++;
  17.         e = p + strlen(p);
  18.         while (e > p && (e[-1] == ' ' || e[-1] == '\t' || e[-1] == '\n')) e--;
  19.         *e = '\0';
  20.         if (*p) puts(p);
  21.     }
  22.     }
  23. }
  24.